namespace SolidMvvmLite {
	using System;
	using System.ComponentModel;
	using System.Linq.Expressions;

	using Windows.UI.Xaml;

	public abstract class PropertyChangedNotifier : DependencyObject, INotifyPropertyChanged {
		////        // Uncomment this method for debugging to make sure that disposable objects get cleaned up.
		////#if DEBUG
		////        ~PropertyChangedNotifier()
		////        {
		////            if (PropertyChanged != null)
		////                Debugger.Break(); // Someone didn't unregister from this event.
		////        }
		////#endif

		public event PropertyChangedEventHandler PropertyChanged;

		protected void RaisePropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }

		protected virtual void RaisePropertyChanged<TProperty>(Expression<Func<TProperty>> propertyLambda) {
			if (PropertyChanged != null) {
				var body = (MemberExpression)propertyLambda.Body;
				PropertyChanged(this, new PropertyChangedEventArgs(body.Member.Name));
			}
		}
	}
}
